<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组去重</title>
</head>
<body>
  <input type="text" id="inputArray" placeholder="请输入数组，用逗号分隔">
  <button onclick="removeDuplicates()">去重</button>
  <div id="output"></div>

  <script>
    function removeDuplicates() {
      let input = document.getElementById('inputArray').value;
      let array = input.split(',').map(item => parseInt(item.trim())); 
      let uniqueArray = Array.from(new Set(array)); 
      document.getElementById('output').innerText = "去重后的数组：" + uniqueArray.join(', ');  
    }
  </script>
</body>
</html>